﻿
IF (EXISTS(SELECT id from sysobjects where id=object_id('usp_AddVote')))
	DROP PROCEDURE [dbo].[usp_AddVote]
GO

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go




create procedure usp_AddVote
@CandidateId as int,
@Votes as nvarchar(50),
@VoterId as nvarchar(50),
@ElectionId as nvarchar(50)

as
update TblCandidate set NoOfVotes = @Votes
where 
CandidateId = @CandidateId;

insert into TblVoterVote (VoterId,CandidateId,ElectionId)
values
(@VoterId,@CandidateId,@ElectionId)
